import axios from '@/libs/api.request'

export const getTableData = () => {
  return axios.request({
    url: 'get_table_data',
    method: 'get'
  })
}

export const getDragList = () => {
  return axios.request({
    url: 'get_drag_list',
    method: 'get'
  })
}

export const errorReq = () => {
  return axios.request({
    url: 'error_url',
    method: 'post'
  })
}

export const saveErrorLogger = info => {
  return axios.request({
    url: 'save_error_logger',
    data: info,
    method: 'post'
  })
}

export const uploadImg = formData => {
  return axios.request({
    url: 'image/upload',
    data: formData
  })
}

export const getOrgData = () => {
  return axios.request({
    url: 'get_org_data',
    method: 'get'
  })
}

export const getTreeSelectData = () => {
  return axios.request({
    url: 'get_tree_select_data',
    method: 'get'
  })
}
/* 部署 */
export const deployWindows = {
  getDeployWindowsList: function () {
    return axios.request({
      url: 'deployWindows/getDeployWindowsList',
      method: 'get'
    })
  },
  saveDeployWindowsList: function (obj) {
    return axios.request({
      url: 'deployWindows/saveDeployWindowsList',
      method: 'post',
      data: obj
    })
  },
  getFiles: function () {
    return axios.request({
      url: 'deployWindows/getFiles',
      method: 'get'
    })
  },
  deleteFile: function (id) {
    return axios.request({
      url: 'deployWindows/deleteFile',
      method: 'post',
      params: {
        id
      }
    })
  },
  updatePatch: function (obj) {
    return axios.request({
      url: 'deployWindows/updatePatch',
      method: 'post',
      data: obj
    })
  },
  queryStatus: function (obj) {
    return axios.request({
      url: 'deployWindows/queryStatus',
      method: 'post',
      data: obj
    })
  },
  executeKill: function (obj) {
    return axios.request({
      url: 'deployWindows/executeKill',
      method: 'post',
      data: obj
    })
  },
  doStart: function (obj) {
    return axios.request({
      url: 'deployWindows/doStart',
      method: 'post',
      data: obj
    })
  },
  doStop: function (obj) {
    return axios.request({
      url: 'deployWindows/doStop',
      method: 'post',
      data: obj
    })
  }
}
